<!--
 * @Author: maomao
 * @Date: 2021-04-14 09:22:03
 * @Description: 图片上传组件
 * @FilePath: \clientapp\src\components\photos-upload.vue
-->
<template>
  <div>
    <el-upload
      action="https://jsonplaceholder.typicode.com/posts/"
      list-type="picture-card"
      :on-preview="handlePictureCardPreview"
      :on-remove="handleRemove"
    >
      <i class="el-icon-plus"></i>
    </el-upload>
    <el-dialog v-model="dialogVisible">
      <img width="100%" :src="dialogImageUrl" class="image-plus" alt="" />
    </el-dialog>
  </div>
</template>
<script lang='ts'>
import { Options, Vue } from "vue-property-decorator/lib";
import { ElUpload, ElDialog } from "element-plus";
@Options({
  components: {
    ElUpload,
    ElDialog,
  },
  props: {
      photos: Array,
  }
})
export default class PhotosUpload extends Vue {
  dialogImageUrl = "";
  dialogVisible: Boolean = false;
  //已移除
  handleRemove(file, fileList) {
    console.log(file, fileList);
  }
  //点击查看大图
  handlePictureCardPreview(file) {
    this.dialogImageUrl = file.url;
    this.dialogVisible = true;
  }
}
</script>